﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;

namespace QQMusic.Controls
{
    public class TextButton : Button
    {
        public static readonly DependencyProperty TextProperty = DependencyProperty.Register("Text", typeof(string), typeof(TextButton), new PropertyMetadata(""));

        /// <summary>
        /// 文字
        /// </summary>
        [Description("文本"), Category("WzxSkin")]
        public string Text
        {
            get { return (string)GetValue(TextProperty); }
            set { SetValue(TextProperty, value); }
        }

        public static readonly DependencyProperty TextColorProperty = DependencyProperty.Register("TextColor", typeof(Brush),
            typeof(TextButton), new PropertyMetadata(Brushes.Gray, OnPropertyChanged));

        /// <summary>
        /// 文字颜色
        /// </summary>
        public Brush TextColor
        {
            set { SetValue(TextColorProperty, value); }
            get { return (Brush)GetValue(TextColorProperty); }
        }

        private static void OnPropertyChanged(DependencyObject dependency, DependencyPropertyChangedEventArgs args)
        {
            TextButton button = dependency as TextButton;
            if (args.Property.Name.Equals("TextColor"))
            {
                button.TextColor = (Brush)args.NewValue;
            }
        }
    }
}
